﻿using AXExtension.Filters;
using Microsoft.VisualStudio.TestTools.UITest.Common;

namespace AXExtension
{
	/// <summary>
	/// The actual CUIT extension that runs the
	/// abstract filters.
	/// </summary>
    internal class AXActionFilter : UITestActionFilter
    {
        #region Simple Properties

        public override bool ApplyTimeout
        {
            get { return true; }
        }

        public override UITestActionFilterCategory Category
        {
            get { return UITestActionFilterCategory.PostGeneral; }
        }

        public override bool Enabled
        {
            get { return true; }
        }

        public override UITestActionFilterType FilterType
        {
            get { return UITestActionFilterType.Unary; }
        }

        public override string Group
        {
            get { return "AXActionFilters"; }
        }

        public override string Name
        {
			get { return "AXActionFilter"; }
        }

        #endregion

		private static FilterGroup group;

		static AXActionFilter()
		{
			// Order does matter, so be careful about
			// where you put new filters.
			group = new FilterGroup(
				new RemoveRedundancyFilter(),
				//new TracerFilter(),
				new SegmentedEntryFilter(),
				new NavigationPaneFilter(),
				new GridFilter(),
				new DropdownUncachingFilter(),
				new WindowTitleFilter());
		}

		public override bool ProcessRule(IUITestActionStack actionStack)
		{
			group.Run(actionStack);
			
            return false;
        }
    }
}
